/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package documenteditor.entidade.model;

import java.io.Serializable;
import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import org.hibernate.annotations.ForeignKey;

/**
 *
 * @author gleidson.moura
 */
@Embeddable
public class ClienteBrindePK implements Serializable {

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @ForeignKey(name="PK_CLIENTE_BRINDE_CLIENTE")
    private Cliente cliente;

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @ForeignKey(name="PK_CLIENTE_BRINDE_BRINDE")
    private Brinde brinde;

    public Brinde getBrinde() {
        return brinde;
    }

    public void setBrinde(Brinde brinde) {
        this.brinde = brinde;
    }

    public Cliente getCliente() {
        return cliente;
    }

    public void setCliente(Cliente cliente) {
        this.cliente = cliente;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ClienteBrindePK other = (ClienteBrindePK) obj;
        if (this.cliente != other.cliente && (this.cliente == null || !this.cliente.equals(other.cliente))) {
            return false;
        }
        if (this.brinde != other.brinde && (this.brinde == null || !this.brinde.equals(other.brinde))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 37 * hash + (this.cliente != null ? this.cliente.hashCode() : 0);
        hash = 37 * hash + (this.brinde != null ? this.brinde.hashCode() : 0);
        return hash;
    }
}
